package com.fingard.dsp.bank.reqrespobj.single;

import java.util.HashMap;

import com.fingard.dsp.bank.reqrespobj.ReqRespHeader;
import com.fingard.dsp.bank.reqrespobj.RequestBase;
import com.fingard.dsp.bank.reqrespobj.single.detail.ReqQrySglBatPayDetail;
import com.fingard.xml.XmlReadMode;
import com.fingard.xml.XmlTextReader;

//单笔合批状态查询请求对象
public class ReqQrySingleBat extends RequestBase {

    public String reqBatchNO;

    private XmlTextReader xmlReader;

    public ReqQrySingleBat(XmlTextReader p_xmlReader, ReqRespHeader p_header) throws Exception{
        reqHeader = p_header;
        xmlReader = p_xmlReader;
        reqBatchNO = xmlReader.getSimpleText("ReqBatchNO");
    }

    public ReqQrySglBatPayDetail readedDetail;
    public boolean readRecord() throws Exception{
        readedDetail = null;
        if(xmlReader.read(PATH_Detail)){
            readedDetail = new ReqQrySglBatPayDetail(xmlReader.readedXElement,reqHeader.bankCode);
            return true;
        }
        else{
            return false;
        }
    }
    
    public void resetRead(){
    	xmlReader.resetReadMode(XmlReadMode.XElementReader);
    }
    
    public HashMap<String, ReqQrySglBatPayDetail> readAllDetail() throws Exception{
    	HashMap<String,ReqQrySglBatPayDetail> mapQryDetail = new HashMap<String,ReqQrySglBatPayDetail>();
    	while (readRecord()) {
    		mapQryDetail.put(readedDetail.reqSeqID, readedDetail);
    	}
    	return mapQryDetail;
    }
}
